package com.robot.mannge.auth.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.robot.mannge.auth.domain.vo.SysUserVO;
import com.robot.mannge.auth.mapper.SysUserMapper;
import com.robot.mannge.auth.service.SysUserService;
import com.robot.mannge.common.entity.sys.SysUserDO;
import com.robot.mannge.common.result.BaseResult;
import com.robot.mannge.common.utils.JacksonUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author: Smile
 * @Date: 2024/01/29/16:58
 * @Description:
 */
@Service
public class SysUserServiceImpl implements SysUserService {

    @Resource
    private SysUserMapper sysUserMapper;


    /**
     * 根据用户名查询用户信息
     * @param username
     * @return
     */
    @Override
    public SysUserVO findUserByUserName(String username) {
        QueryWrapper<SysUserDO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username",username);
        SysUserDO sysUserDO = sysUserMapper.selectOne(queryWrapper);
        SysUserVO sysUserVO = JacksonUtil.objectToObject(sysUserDO, SysUserVO.class);
        return sysUserVO;
    }


}
